import { request } from "request/index.js";
import regeneratorRuntime from "libs/runtime/runtime";

App({
    globalData: {
        globalData: {
            token: "",
            nickName: "",
            avatarUrl: "",
        },
        carts: [], //购物车数据
    },
    onLaunch: function() {
        this.globalData.sysInfo = wx.getSystemInfoSync();
        // 小程序启动加载购物车数据
        this.globalData.carts = wx.getStorageSync("carts") || [];

        // 展示本地存储能力
        var logs = wx.getStorageSync("logs") || [];
        logs.unshift(Date.now());
    },
    //更新购物车数据到本地存储中
    storeCarts() {
        wx.setStorage({
            key: "carts",
            data: this.globalData.carts,
        });
    },
    // showModalTitle() {
    //     wx.showModal({
    //         title: "您还未登录,请登录!",
    //         content: "",
    //         showCancel: true,
    //         cancelText: "取消",
    //         cancelColor: "#000000",
    //         confirmText: "确定",
    //         confirmColor: "#3CC51F",
    //         success: (result) => {
    //             console.log(result);
    //             if (result.confirm) {}
    //         },
    //     });
    // },

    onShow: function() {},
    onHide: function() {},
});